home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / gfx / misc / gnuplot-src.lha / gnuplot-3.7.1src / gnuplot-3.7.1.lha / gnuplot-3.7.1 / m4 / select.m4 < prev   
Encoding:
M4 Source File  |  1999-10-15  |  2.6 KB  |  88 lines

  1. dnl testing øÄ
  2. UNC_SELECT
  3.  
  4. AC_DEFUN(AC_FUNC_SELECT,
  5. [AC_CHECK_FUNCS(select)
  6. if test "$ac_cv_func_select" = yes; then
  7.   AC_CHECK_HEADERS(unistd.h sys/types.h sys/time.h sys/select.h sys/socket.h)
  8.   AC_MSG_CHECKING([argument types of select()])
  9.   AC_CACHE_VAL(ac_cv_type_fd_set_size_t,dnl
  10.     [AC_CACHE_VAL(ac_cv_type_fd_set,dnl
  11.       [for ac_cv_type_fd_set in 'fd_set' 'int' 'void'; do
  12.         for ac_cv_type_fd_set_size_t in 'int' 'size_t' 'unsigned long' 'unsigned'; do
  13.       for ac_type_timeval in 'struct timeval' 'const struct timeval'; do
  14.             AC_TRY_COMPILE(dnl
  15. [#ifdef HAVE_SYS_TIME_H
  16. #include <sys/time.h>
  17. #endif
  18. #ifdef HAVE_SYS_TYPES_H
  19. #include <sys/types.h>
  20. #endif
  21. #ifdef HAVE_UNISTD_H
  22. #include <unistd.h>
  23. #endif
  24. #ifdef HAVE_SYS_SELECT_H
  25. #include <sys/select.h>
  26. #endif
  27. #ifdef HAVE_SYS_SOCKET_H
  28. #include <sys/socket.h>
  29. #endif],
  30. [#ifdef __STDC__
  31. extern int select ($ac_cv_type_fd_set_size_t, 
  32.  $ac_cv_type_fd_set *,    $ac_cv_type_fd_set *, $ac_cv_type_fd_set *,
  33.  $ac_type_timeval *);
  34. #else
  35. extern int select ();
  36.   $ac_cv_type_fd_set_size_t s;
  37.   $ac_cv_type_fd_set *p;
  38.   $ac_type_timeval *t;
  39. #endif],
  40. [ac_found=yes ; break 3],ac_found=no)
  41.           done
  42.         done
  43.       done
  44.     ])dnl AC_CACHE_VAL
  45.   ])dnl AC_CACHE_VAL
  46.   if test "$ac_found" = no; then
  47.     AC_MSG_ERROR([can't determine argument types])
  48.   fi
  49.  
  50.   AC_MSG_RESULT([select($ac_cv_type_fd_set_size_t,$ac_cv_type_fd_set *,...)])
  51.   AC_DEFINE_UNQUOTED(fd_set_size_t, $ac_cv_type_fd_set_size_t,
  52.                      [ First arg for select(). ])
  53.   ac_cast=
  54.   if test "$ac_cv_type_fd_set" != fd_set; then
  55.     # Arguments 2-4 are not fd_set.  Some weirdo systems use fd_set type for
  56.     # FD_SET macros, but insist that you cast the argument to select.  I don't
  57.     # understand why that might be, but it means we cannot define fd_set.
  58.     AC_EGREP_CPP(dnl
  59. changequote(<<,>>)dnl
  60. <<(^|[^a-zA-Z_0-9])fd_set[^a-zA-Z_0-9]>>dnl
  61. changequote([,]),dnl
  62. [#ifdef HAVE_SYS_TIME_H
  63. #include <sys/time.h>
  64. #endif
  65. #ifdef HAVE_SYS_TYPES_H
  66. #include <sys/types.h>
  67. #endif
  68. #ifdef HAVE_UNISTD_H
  69. #include <unistd.h>
  70. #endif
  71. #ifdef HAVE_SYS_SELECT_H
  72. #include <sys/select.h>
  73. #endif
  74. #ifdef HAVE_SYS_SOCKET_H
  75. #include <sys/socket.h>
  76. #endif],dnl
  77.     # We found fd_set type in a header, need special cast
  78.     ac_cast="($ac_cv_type_fd_set *)",dnl
  79.     # No fd_set type; it is safe to define it
  80.     AC_DEFINE_UNQUOTED(fd_set,$ac_cv_type_fd_set,
  81.                        [ Define if the type in arguments 2-4 to select() is fd_set. ]))
  82.   fi
  83.   AC_DEFINE_UNQUOTED(SELECT_FD_SET_CAST,$ac_cast,
  84.                      [ Define if the type in arguments 2-4 to select() is fd_set. ])
  85. fi
  86. ])
  87.  
  88.